package mlp.game.shadownbolts;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;

public class ProjectileCollector {
	private Paint paint;
	public int height = 100;
	public RectF rect;
	public Spitfire player;
	
	public ProjectileCollector(Spitfire player){
		paint = new Paint();
		paint.setColor(Color.GREEN);
		paint.setStyle(Style.FILL_AND_STROKE);
		this.player = player;
		this.rect = new RectF(-140, player.getFrame().centerY() - (height / 2), 10, (player.getFrame().centerY() - (height / 2)) + this.height);
	}
	
	public void update(long gameTime){
		this.rect.top = this.rect.top + (player.getPosition().y - this.rect.top) / 10;
		this.rect.bottom = this.rect.top + this.height;
	}
	
	public void draw(Canvas canvas){
		if(RenderView.SHOW_DEBUG_INFO)
			canvas.drawRect(rect, paint);
	}
	
	public int getX(){
		return (int) this.rect.left;
	}
}
